﻿<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script type="text/javascript">
    $(document).ready(function () {    
        loadReport1();
        loadReport2();
        loadReport3();
        loadReport4();
    });
    function loadReport1() {
        var userid = '<%=Session["Userid"]%>';
        var a1 = new Array();
        var chart1;
        if (userid != null || userid != "") {
            $.ajax({
                type: "POST",
                url: "PIMService.asmx/GetReport1",
                data: "{'UserId':'" + userid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    var report1 = eval(response.d);
                    $.each(report1, function () {
                        var b1 = new Object();
                        b1.Name = this.Name;
                        b1.Today = this.Today;
                        b1.Target = this.Target;
                        a1.push(b1);
                    });
                    chart1 = new cfx.Chart();
                    chart1.getAnimations().getLoad().setEnabled(true);
                    chart1.setGallery(cfx.Gallery.Bar);
                    chart1.getView3D().setEnabled(true);
                    var series1 = chart1.getSeries().getItem(0);
                    series1.setColor("#C6514A");
                    var series2 = chart1.getSeries().getItem(1);
                    series2.setColor("#5282BD");
                    chart1.setDataSource(a1);
                    var divHolder1 = document.getElementById('ChartDiv1');
                    chart1.create(divHolder1);


                },
                error: function (msg) {

                }
            });
        }
    }

    function loadReport2() {
        var userid = '<%=Session["Userid"]%>';
        var a2 = new Array();
        var chart2;
        if (userid != null || userid != "") {
            $.ajax({
                type: "POST",
                url: "PIMService.asmx/GetReport2",
                data: "{'UserId':'" + userid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    var report1 = eval(response.d);
                    $.each(report1, function () {
                        var b2 = new Object();
                        b2.Name = this.Name;
                        b2.Today = this.Today;
                        b2.Target = this.Target;
                        a2.push(b2);
                    });
                    chart2 = new cfx.Chart();
                    chart2.getAnimations().getLoad().setEnabled(true);
                    chart2.setGallery(cfx.Gallery.Gantt);
                    chart2.getView3D().setEnabled(true);
                    var series1 = chart2.getSeries().getItem(0);
                    series1.setColor("#C6514A");
                    var series2 = chart2.getSeries().getItem(1);
                    series2.setColor("#5282BD");
                    chart2.setDataSource(a2);
                    var divHolder2 = document.getElementById('ChartDiv2');
                    chart2.create(divHolder2);
                },
                error: function (msg) {

                }
            });
        }
    }

    function loadReport3() {
        var userid = '<%=Session["Userid"]%>';
        var a3 = new Array();
        var chart3;
        if (userid != null || userid != "") {
            $.ajax({
                type: "POST",
                url: "PIMService.asmx/GetReport3",
                data: "{'UserId':'" + userid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    var report1 = eval(response.d);
                    $.each(report1, function () {
                        var b3 = new Object();
                        b3.Name = this.Name;
                        b3.YourCalorie = this.YourCalorie;
                        b3.TargetCalorie = this.TargetCalorie;
                        a3.push(b3);
                    });
                    chart3 = new cfx.Chart();
                    chart3.getAnimations().getLoad().setEnabled(true);
                    chart3.setGallery(cfx.Gallery.Lines);

                    chart3.getAxisX().setLabelAngle(90);
                    var series1 = chart3.getSeries().getItem(0);
                    series1.setColor("#C6514A");
                    var series2 = chart3.getSeries().getItem(1);
                    series2.setColor("#5282BD");
                    chart3.setDataSource(a3);
                    var divHolder3 = document.getElementById('ChartDiv3');
                    chart3.create(divHolder3);
                    LineTitle1 = new cfx.TitleDockable();
                    LineTitle1.setText("My Calorie Goal");
                    chart3.getTitles().add(LineTitle1);
                    chart3.getSeries().getItem(0).setText("Your Calorie");
                    chart3.getSeries().getItem(1).setText("Target Calorie");
                },
                error: function (msg) {

                }
            });
        }
    }
    function loadReport4() {
        var userid = '<%=Session["Userid"]%>';
        var a4 = new Array();
        var chart4;
        if (userid != null || userid != "") {
            $.ajax({
                type: "POST",
                url: "PIMService.asmx/GetReport4",
                data: "{'UserId':'" + userid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    var report1 = eval(response.d);
                    $.each(report1, function () {
                        var b4 = new Object();
                        b4.Name = this.Name;
                        b4.YourWeight = this.YourWeight;
                        b4.Target = this.Target;
                        a4.push(b4);
                    });
                    chart4 = new cfx.Chart();
                    chart4.getAnimations().getLoad().setEnabled(true);
                    var series1 = chart4.getSeries().getItem(0);
                    series1.setColor("#C6514A");
                    var series2 = chart4.getSeries().getItem(1);
                    series2.setColor("#5282BD");
                    chart4.getAxisX().setLabelAngle(90);
                    chart4.setGallery(cfx.Gallery.Lines);
                    chart4.setDataSource(a4);
                    var divHolder3 = document.getElementById('ChartDiv4');
                    chart4.create(divHolder3);
                    LineTitle1 = new cfx.TitleDockable();
                    LineTitle1.setText("My Weight Goal");
                    chart4.getTitles().add(LineTitle1);
                    chart4.getSeries().getItem(0).setText("Your Weight");
                    chart4.getSeries().getItem(1).setText("Target");
                },
                error: function (msg) {

                }
            });
        }
    }
       
    </script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
   
   
  

</head>
<body>
<form id="form1" runat="server">
 <div class="box_profiles">
<div class="box_profiles01">
    <div  id="ChartDiv1" class="box_profilesChildren01">
							
	</div>
</div>
<div class="box_profiles02">
    <div  id="ChartDiv2" class="box_profilesChildren01">
							
	</div>
</div>
</div>
<div class="box_profiles">
<div class="box_profiles01">
   <div id="ChartDiv3" class="box_profilesChildren01">		
	</div>
</div>
<div class="box_profiles02">
   <div id="ChartDiv4" class="box_profilesChildren01">								
	</div>
</div>
</div>
</form>
</body>
</html>
